package com.market.manage.controller;

import com.market.manage.po.Role;
import com.market.manage.service.RoleService;
import com.market.po.Result;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 角色管理控制器
 */
@CrossOrigin
@RestController
@RequestMapping(value = "/roles")
public class RoleController {

    @Resource
    private RoleService roleServiceImpl;

    @GetMapping("/getRoles")
    public Result getRole() {
        return roleServiceImpl.getRole();
    }

    @GetMapping("/selRoles")
    public Result selRoles(Long id, String job, Integer pageIndex, Integer pageSize) {
        return roleServiceImpl.selRoles(id, job, pageIndex, pageSize);
    }

    @GetMapping("/edit")
    public void edit(Role role) {
        roleServiceImpl.edit(role);
    }

    @GetMapping("/delete")
    public void delete(Long id) {
        roleServiceImpl.delete(id);
    }
}
